Hey all!
A few moons ago Purple and Sor helped me out with this Scoreboard for jvbots.
Anyway, as it stands under 1.11, human players that join are assigned a "number" as their name on the bot scoreboard. eg "Player 0, player 1 player 2 consequently. etc).
Now, there was never a way to display real player names on the bot scoreboard (without going to reborn) - which doesn't work well for me with my hosted bot server currently.
What I would like to therefore do is write a quick script that would extract the data from the ("Player " + $player[local.i].entnum)
entry (or from elsewhere if appropriate), and tell a player on-screen who they are whenever they enter a new cycled map.
Eg If a map starts and the scoreboard script assigns this player as "Player 3", then the hud displays a 3 second: "Welcome [Real Name]. You are Player 3 on the Bot Scoreboard" etc.
I presume this might have to be a script created that is executed from each map's .scr ?
Any solutions? Don't know how to code it to do this.
Many thanks, as always.
Excerpt that I think is relevant...
Code:if ($player[local.i].dmteam != "spectator") { local.t = $player[local.i].dmteam local.active_players++ local.p[local.t]++ if (level.botsc_array == NIL) { local.c = 1 } else { local.c = ( level.botsc_array.size + 1 ) } level.botsc_array[local.c][1] = ("Player " + $player[local.i].entnum) level.botsc_array[local.c][2] = local.t level.botsc_array[local.c][3] = ( $player[local.i].killcount + $player[local.i].bot_killcount ) level.botsc_array[local.c][4] = $player[local.i].deathcount if ( (isAlive $player[local.i]) ) level.botsc_array[local.c][5] = active else level.botsc_array[local.c][5] = dead }
Full Script, if needed:
Code:/* ====================================================== *** Multiplayer BotScript; Scoreboard for MoH:AA ====================================================== by Sor Version: v3.0 r32 ----------------------------------- --- CHANGES: * Redone the entire system * New ui scoreboard (ui/bot_scoreboard.urc) * Now you can see which bot killed you * Keeps track of up to 32 bots (players included) * Dead bots/players indicated * Use of globalwidgets reduces the cvar use from 90 to 32. * Increased efficiency; reduction of lag * No more executions from the lib_game.scr script; reduction of lag * Player deaths are now displayed and accurately * All players get displayed; I cannot display their names (so I display their clientnumber) * Scoreboard FULLY viewable by all players on the server (if they have the ui/bot_scoreboard.urc file of course) Additional Fixes: * Rifle hit/whip sounds as well as the toses_ sound. Required Edited Scripts: - global/jv_bots/spawnhandler_default.scr - global/jv_mp_players.scr ------------------- --- COPY/EDIT: A) All files related to the Airborne Server for MoHAA are free to be modified in any proportion. For any reason. Mods can always be made better :) B) Keep this heading in this file in any case (modified/original) and if you wish, add your own nickname/contact underneath it. C) If you changed the files in any way, please state so clearly when releasing it to the public. I also recommend: marking or mentioning what you changed exactly in the modified files. Feel free to ask me any help regarding problems/bugs when playing this Mod or regarding the modification this Mod. ------------------- DO NOT TAKE CREDIT FOR OTHER PEOPLE'S WORK! EITHER SUBMIT MODIFIED/ORIGINAL WORK WITHOUT CREDIT OR JUST CREDIT Sor. --------------------------------------------- --- CONTACT: E-Mail: MOHAALennySoldier@hotmail.com Webs: www.mods-r-us.net | www.mohaairborne.co.cc ====================================================== */ main: if (level.sc_running == 1) end level.sc_running = 1 local.master = spawn ScriptMaster local.master aliascache toses_ sound/default.wav soundparms 0 0 0 0 0 0 auto loaded maps "m dm obj moh train " local.master aliascache rifle_whip1 sound/weapons/foley/PistolWhip1.wav soundparms 1.0 0.1 0.95 0.1 250 1000 auto loaded maps "m dm obj moh train " local.master aliascache rifle_whip2 sound/weapons/foley/PistolWhip2.wav soundparms 1.0 0.1 0.95 0.1 250 1000 auto loaded maps "m dm obj moh train " local.master aliascache rifle_hit1 sound/weapons/foley/PistolHit1.wav soundparms 1.5 0.0 0.95 0.1 250 1000 auto loaded maps "m dm obj moh train " local.master aliascache rifle_hit2 sound/weapons/foley/PistolHit2.wav soundparms 1.5 0.0 0.95 0.1 250 1000 auto loaded maps "m dm obj moh train " local.master aliascache rifle_hit3 sound/weapons/foley/PistolHit3.wav soundparms 1.5 0.0 0.95 0.1 250 1000 auto loaded maps "m dm obj moh train " wait 2.5 while(1) { if (level.jvbot_jv_mp_ai_running == 1 && level.bots > 0 && $player.size >= 1) { // Number of scores we can display; 16 each team level.score_display_size = 32 // Reset array level.botsc_array = NIL // First check active players local.p["axis"] = 0 local.p["allies"] = 0 local.active_players = 0 for (local.i = 1; local.i <= $player.size; local.i++) { if ($player[local.i].killcount == NIL) $player[local.i].killcount = 0 if ($player[local.i].bot_killcount == NIL) $player[local.i].bot_killcount = 0 if ($player[local.i].deathcount == NIL) $player[local.i].deathcount = 0 if ($player[local.i].dmteam != "spectator") { local.t = $player[local.i].dmteam local.active_players++ local.p[local.t]++ if (level.botsc_array == NIL) { local.c = 1 } else { local.c = ( level.botsc_array.size + 1 ) } level.botsc_array[local.c][1] = ("Player " + $player[local.i].entnum) level.botsc_array[local.c][2] = local.t level.botsc_array[local.c][3] = ( $player[local.i].killcount + $player[local.i].bot_killcount ) level.botsc_array[local.c][4] = $player[local.i].deathcount if ( (isAlive $player[local.i]) ) level.botsc_array[local.c][5] = active else level.botsc_array[local.c][5] = dead } } level.score_display_size -= local.active_players // Check number of active bots per team local.b["allies"] = 0 local.b["axis"] = 0 local.active_bots = 0 local.temp = 0 for (local.i = 1; local.i <= (level.score_display_size + local.temp) && local.i <= level.botnum; local.i++) { if (level.botstate[local.i] != "away" && level.botname[local.i] != NIL ) { if (level.botsc_array == NIL) { local.c = 1 } else { local.c = ( level.botsc_array.size + 1 ) } level.botsc_array[local.c][1] = level.botname[local.i] level.botsc_array[local.c][2] = level.botteam[local.i] level.botsc_array[local.c][3] = level.sc_kills[local.i] level.botsc_array[local.c][4] = level.sc_deaths[local.i] level.botsc_array[local.c][5] = level.botstate[local.i] local.t = level.botteam[local.i] local.b[local.t]++ local.active_bots++ } else { if ( (level.score_display_size + local.temp) < level.botnum) { local.temp++ } } } level.score_display_size -= local.active_bots // Get all scores: local.kills["axis"] = 0 local.kills["allies"] = 0 local.deaths["axis"] = 0 local.deaths["allies"] = 0 for (local.i = 1; local.i <= level.botsc_array.size; local.i++) { local.t = level.botsc_array[local.i][2] local.kills[local.t] += level.botsc_array[local.i][3] local.deaths[local.t] += level.botsc_array[local.i][4] } if (local.kills["axis"] > local.kills["allies"]) { local.winning = "axis" }a else if (local.kills["axis"] < local.kills["allies"]) { local.winning = "allies" } else if (local.kills["axis"] == local.kills["allies"]) { if (local.deaths["axis"] < local.deaths["allies"]) { local.winning = "axis" } else if (local.deaths["axis"] > local.deaths["allies"]) { local.winning = "allies" } else if (local.deaths["axis"] == local.deaths["allies"]) { local.winning = "allies" } } // start the bubble sort function //[1] = name //[2] = team //[3] = kills //[4] = deaths //[5] = state for (local.i = 1; local.i <= level.botsc_array.size; local.i++) { for ( local.j = 1; local.j <= (level.botsc_array.size - local.i); local.j++) { if ( level.botsc_array[local.i][3] >= level.botsc_array[local.i + local.j][3] ) { if ( level.botsc_array[local.i][3] == level.botsc_array[local.i + local.j][3] ) { if ( level.botsc_array[local.i][4] > level.botsc_array[local.i + local.j][4] ) { //switch information for (local.f = 1; local.f <= 5; local.f++) { local.temp = level.botsc_array[local.i][local.f] level.botsc_array[local.i][local.f] = level.botsc_array[local.i + local.j][local.f] level.botsc_array[local.i + local.j][local.f] = local.temp } } } } else { //switch information for (local.f = 1; local.f <= 5; local.f++) { local.temp = level.botsc_array[local.i][local.f] level.botsc_array[local.i][local.f] = level.botsc_array[local.i + local.j][local.f] level.botsc_array[local.i + local.j][local.f] = local.temp } } } } // ===================================================================== // Update Scoreboard // ------------------ // - Using globalwidgets to do every varying item except the names; // that's about 32 cvars // - Using globalwidgets to colour names of bots/player // who aren't actively playing // - Clearing all unused varying items // // ---> New scoreboard ui // ====================================================================== for (local.i = 1; local. i <= $player.size; local.i++) { if (local.winning == "allies") { $player[local.i] stufftext "globalwidgetcommand topteam title Allies" $player[local.i] stufftext "globalwidgetcommand bottomteam title Axis" $player[local.i] stufftext ("globalwidgetcommand topscore title " + local.kills["allies"]) $player[local.i] stufftext ("globalwidgetcommand bottomscore title " + local.kills["axis"]) $player[local.i] stufftext ("globalwidgetcommand topkilled title " + local.deaths["allies"]) $player[local.i] stufftext ("globalwidgetcommand bottomkilled title " + local.deaths["axis"]) waitframe } else { $player[local.i] stufftext "globalwidgetcommand topteam title Axis" $player[local.i] stufftext "globalwidgetcommand bottomteam title Allies" $player[local.i] stufftext ("globalwidgetcommand topscore title " + local.kills["axis"]) $player[local.i] stufftext ("globalwidgetcommand bottomscore title " + local.kills["allies"]) $player[local.i] stufftext ("globalwidgetcommand topkilled title " + local.deaths["axis"]) $player[local.i] stufftext ("globalwidgetcommand bottomkilled title " + local.deaths["allies"]) waitframe } local.w = 0 local.z = 0 for (local.f = 1; local.f <= level.botsc_array.size; local.f++) { if (level.botsc_array[local.f][2] == local.winning) { local.w++ $player[local.i] stufftext ("set botsc_up" + local.w + " " + level.botsc_array[local.f][1]) if (level.botsc_array[local.f][5] != active) $player[local.i] stufftext ("globalwidgetcommand botsc_up" + local.w + " fgcolor 0.70 0.60 0.05 1.00") else $player[local.i] stufftext ("globalwidgetcommand botsc_up" + local.w + " fgcolor 1.00 1.00 1.00 1.00") } else { local.z++ $player[local.i] stufftext ("set botsc_down" + local.z + " " + level.botsc_array[local.f][1]) if (level.botsc_array[local.f][5] != active) $player[local.i] stufftext ("globalwidgetcommand botsc_down" + local.z + " fgcolor 0.70 0.60 0.05 1.00") else $player[local.i] stufftext ("globalwidgetcommand botsc_down" + local.z + " fgcolor 1.00 1.00 1.00 1.00") } } local.w = 0 local.z = 0 for (local.f = 1; local.f <= level.botsc_array.size; local.f++) { if (level.botsc_array[local.f][2] == local.winning) { local.w++ $player[local.i] stufftext ("globalwidgetcommand botk_up" + local.w + " title " + level.botsc_array[local.f][3]) $player[local.i] stufftext ("globalwidgetcommand botd_up" + local.w + " title " + level.botsc_array[local.f][4]) waitframe } else { local.z++ $player[local.i] stufftext ("globalwidgetcommand botk_down" + local.z + " title " + level.botsc_array[local.f][3]) $player[local.i] stufftext ("globalwidgetcommand botd_down" + local.z + " title " + level.botsc_array[local.f][4]) waitframe } } for (local.o = (local.w + 1); local.o <= 16; local.o++) { if ( (getcvar ("botsc_up" + local.o)) != "" && (getcvar ("botsc_up" + local.o)) != ".") { //setcvar ("botsc_up" + local.o) "" $player[local.i] stufftext ("set botsc_up" + local.o + " .") $player[local.i] stufftext ("globalwidgetcommand botk_up" + local.o + " title .") $player[local.i] stufftext ("globalwidgetcommand botd_up" + local.o + " title .") $player[local.i] stufftext ("globalwidgetcommand botsc_up" + local.o + " fgcolor 1.00 1.00 1.00 1.00") waitframe } } for (local.o = (local.z + 1); local.o <= 16; local.o++) { if ( (getcvar ("botsc_down" + local.o)) != "" && (getcvar ("botsc_down" + local.o)) != ".") { //setcvar ("botsc_down" + local.o) "" $player[local.i] stufftext ("set botsc_down" + local.o + " .") $player[local.i] stufftext ("globalwidgetcommand botk_down" + local.o + " title .") $player[local.i] stufftext ("globalwidgetcommand botd_down" + local.o + " title .") $player[local.i] stufftext ("globalwidgetcommand botsc_down" + local.o + " fgcolor 1.00 1.00 1.00 1.00") waitframe } } } } wait 0.4 } end


Reply With Quote
